<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:t="http://myfaces.apache.org/tomahawk"
	xmlns:a="http://richfaces.org/a4j" xmlns:a4j="http://richfaces.org/a4j"
	template="/layout/template_box.xhtml"
                xmlns:c="http://java.sun.com/jstl/core">

	<ui:define name="head">
		<a:loadScript src="/js/formataTabela.js" />
		
	</ui:define>

	<ui:define name="MenuInterno">
		<ui:include src="/layout/menu_aluno.xhtml" />
	</ui:define>

	<ui:define name="body">

		<h2 class="t_turma">
			<h:outputText value="Avaliação de Psicogênese do aluno" />
		</h2>

		<div id="tamanho_div">

			<a:outputPanel id="pnlForm" ajaxRendered="true">
				<a:form id="formAvaliacao" styleClass="form_confea">
					

						<ol>
							
							<li><s:div>
									<p class="tool_alerta">Os campos marcados com * são de
										preenchimento obrigatório.</p>
								</s:div></li>
							<li>
								<fieldset>
									<legend>
										<h:outputText value="Dados da Aluno" />
									</legend>
								</fieldset>
							</li>
							
							<li><s:decorate template="/layout/edit.xhtml" id="decoNome">
									<ui:define name="label">
							Aluno
						</ui:define>
									<h:outputText value="#{avaliacaoPsicogeneseHome.aluno.nome}" />

								</s:decorate></li>
								
								
						<li><s:decorate template="/layout/edit.xhtml"
									id="decoTurma">
									<ui:define name="label">
							Turma
						</ui:define>
									<h:selectOneMenu required="false"
										requiredMessage="O campo 'Turma' é obrigatório."
										id="turma" styleClass="Combo" 
										value="#{avaliacaoPsicogeneseHome.turma}">
										<s:selectItems value="#{avaliacaoPsicogeneseHome.aluno.turmasAlfabetizacao}"
											var="turma" label="#{turma.nome}"
											noSelectionLabel="Selecione" />
										<s:convertEntity />
										<a4j:support event="onchange" action="#{avaliacaoPsicogeneseHome.limpaNovasAvaliacoes}" oncomplete="formataTabela();" limitToList="true" reRender="divAvaliacao"  ignoreDupResponses="true" eventsQueue="default" ajaxSingle="true"  />
																		
									</h:selectOneMenu>

								</s:decorate></li>
								
												
						<div id="divAvaliacao">	
							<a4j:repeat value="#{factories.gruposPsicogeneses}" var="grupo" rendered="#{avaliacaoPsicogeneseHome.turma != null}" >
									<div alt="#{grupo.nome}" avaliacao="#{avaliacaoPsicogeneseHome.aluno.getUltimaAvaliacaoPsicogenese(avaliacaoPsicogeneseHome.turma,grupo).psicogenese.codigo}">															
									
										<a4j:repeat value="#{avaliacaoPsicogeneseHome.getAvaliacoes(grupo)}" var="avaliacao" >
												
																						
												  <h:selectOneRadio forceId="true" layout="spread" 
													 immediate="false" id="ava" value="#{avaliacao.psicogenese}"  >
													<s:selectItems value="#{repositorioPsicogenese.porOrdemDecrescente(grupo)}" var="psicogenese" 
														label="#{psicogenese}" />
														<a4j:support event="onclick" oncomplete="formataTabela()" limitToList="true" reRender="divAvaliacao"  ignoreDupResponses="true" eventsQueue="default" ajaxSingle="true"  />
														
													<s:convertEntity/>
												</h:selectOneRadio>
												
												
																		
										</a4j:repeat>
										
										
										<h:selectOneRadio forceId="true" layout="spread" 
											 immediate="false" id="novaAva" value="#{avaliacaoPsicogeneseHome.getNovaAvaliacao(grupo).psicogenese}"  >
											<s:selectItems value="#{repositorioPsicogenese.porOrdemDecrescente(grupo)}" var="psicogenese" 
												label="#{psicogenese}" />
												<a4j:support event="onclick" oncomplete="formataTabela()" limitToList="true" reRender="divAvaliacao"  ignoreDupResponses="true" eventsQueue="default" ajaxSingle="true"  />
												
											<s:convertEntity/>
										</h:selectOneRadio>
									
																		
																		
									</div>
								</a4j:repeat>
						
							

						</div>

						</ol>

						<fieldset>
							<h:messages globalOnly="false" styleClass="tool_alerta" />
						</fieldset>

						<a4j:commandLink styleClass="btn" action="#{avaliacaoPsicogeneseHome.salvar}" ajaxSingle="true" eventsQueue="default" bypassUpdates="true"
							value="Salvar" reRender="pnlForm" oncomplete="formataTabela()"/>

					
				</a:form>
			</a:outputPanel>
		</div>
	</ui:define>

</ui:composition>
